﻿using SIOGDE.Reportes.Core;
using SIOGDE.Reportes.Negocios.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SIOGDE.Web.Controllers
{
    public class ReporteController : Controller
    {
        //
        // GET: /Reporte/

        public ActionResult Index()
        {
            return View();
        }


        public ActionResult FilePersonal(int PersonaId)
        {
            ReportParametersDictionary dic = new ReportParametersDictionary();
            dic.Add(ReportParameterNames.Renderator, ReportsClassNames.FilePersonalReport);
            dic.Add(ReportParameterNames.PersonaId, PersonaId.ToString());
            dic.Add(ReportParameterNames.GestionId, SIOGDE.Negocios.Global.Session.GestionActiva.Id.ToString());
            return Redirect(ReportBuilder.BuildURL(dic));
        }


        public ActionResult ImprimirAsignacion(string guidAsignacion)
        {
            ReportParametersDictionary dic = new ReportParametersDictionary();
            dic.Add(ReportParameterNames.Renderator, ReportsClassNames.MemoAsignacionReport);
            dic.Add(ReportParameterNames.GuidAsignacion, guidAsignacion);
            return Redirect(ReportBuilder.BuildURL(dic));        
        }

        /// <summary>
        /// unidadesIds = 1,2,3,4,5,6
        /// </summary>
        /// <param name="unidadesIds"></param>
        /// <returns></returns>
        public ActionResult RequerimientoConfig(string unidadesIds)
        {
            ReportParametersDictionary dic = new ReportParametersDictionary();
            dic.Add(ReportParameterNames.Renderator, ReportsClassNames.RequerimientoConfigReport);
            dic.Add(ReportParameterNames.UnidadIds, unidadesIds);
            dic.Add(ReportParameterNames.GestionId, SIOGDE.Negocios.Global.Session.GestionActiva.Id.ToString());
            return Redirect(ReportBuilder.BuildURL(dic));
        }

        public ActionResult DestinoPersonal(string unidadesIds="")
        {
            ReportParametersDictionary dic = new ReportParametersDictionary();
            dic.Add(ReportParameterNames.Renderator, ReportsClassNames.DestinoPersonalReport);
            dic.Add(ReportParameterNames.UnidadIds, unidadesIds);
            dic.Add(ReportParameterNames.GestionId, SIOGDE.Negocios.Global.Session.GestionActiva.Id.ToString());
            return Redirect(ReportBuilder.BuildURL(dic));
        }

        public ActionResult RequerimientoPorArma(string armaIds = "", int GestionId = 0)
        {
            ReportParametersDictionary dic = new ReportParametersDictionary();
            dic.Add(ReportParameterNames.Renderator, ReportsClassNames.RequerimientoPorArmaReport);
            dic.Add(ReportParameterNames.ArmaIds, armaIds);
            dic.Add(ReportParameterNames.GestionId, SIOGDE.Negocios.Global.Session.GestionActiva.Id.ToString());
            return Redirect(ReportBuilder.BuildURL(dic));        
        }


        public ActionResult RolUsuario(string rolIds = "")
        {
            ReportParametersDictionary dic = new ReportParametersDictionary();
            dic.Add(ReportParameterNames.Renderator, ReportsClassNames.RolUsuarioReport);
            dic.Add(ReportParameterNames.RolId, rolIds);
            
            return Redirect(ReportBuilder.BuildURL(dic));
        }

    }
}
